package com.example.check_oa.controller;

import com.example.check_oa.model.mapper.OvertimeApMapper;
import com.example.check_oa.model.mapper.OvertimeTypeMapper;
import com.example.comment_oa.pojos.attendance.OvertimeAp;
import com.example.check_oa.model.service.OvertimeApService;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("checkOa/overTime")
public class OverTimeController {
    @Resource
    OvertimeTypeMapper overtimeTypeMapper;
    @Resource
    OvertimeApService overtimeApService;
    @Resource
    OvertimeApMapper overtimeApMapper;

    @PostMapping("query")
    public AjaxResponse query(){
        return AjaxResponse.success(overtimeTypeMapper.selectList(null));
    }

    @PostMapping("add")
    public AjaxResponse add(OvertimeAp overtimeAp, MultipartFile file){
        return AjaxResponse.success(overtimeApService.add(overtimeAp,file));
    }

    @PostMapping("selectByWate/{water}")
    public AjaxResponse add(@PathVariable("water")String water){
        return AjaxResponse.success(overtimeApMapper.selectByWate(water));
    }
}
